
const Koa = require('koa');
const app = new Koa()
const bodyparser = require('koa-bodyparser')
const PORT = 3005;
//  get  /api/user

// 路由引入
const users = require('./router/users')
const blogs = require('./router/blogs')

// 解析参数
app.use(bodyparser());
// 路由注册
app.use(users.routes(), users.allowedMethods())
app.use(blogs.routes(), blogs.allowedMethods())


app.listen(PORT, () => {
  // open(`http://localhost:${PORT}`)
  console.log(`server: http://localhost:${PORT}`)
})